@@ -13,7 +13,7 @@ module EmailConcern |
||
13 | 13 |
if options['recipients'].present? |
14 | 14 |
emails = options['recipients'] |
15 | 15 |
emails = [emails] if emails.is_a?(String) |
16 |
- unless emails.all? { |email| email =~ Devise.email_regexp || email =~ /\{\{/ } |
|
16 |
+ unless emails.all? { |email| email =~ Devise.email_regexp || email =~ /\{/ } |
|
17 | 17 |
errors.add(:base, "'when provided, 'recipients' should be an email address or an array of email addresses") |
18 | 18 |
end |
19 | 19 |
end |
@@ -52,4 +52,4 @@ module EmailConcern |
||
52 | 52 |
def present_hash(hash, skip_key = nil) |
53 | 53 |
hash.to_a.sort_by {|a| a.first.to_s }.map { |k, v| "#{k}: #{v}" unless k.to_s == skip_key.to_s }.compact |
54 | 54 |
end |
55 |
-end |
|
55 |
+end |
@@ -51,6 +51,9 @@ shared_examples_for EmailConcern do |
||
51 | 51 |
agent.options['recipients'] = '{{ email }}' |
52 | 52 |
expect(agent).to be_valid |
53 | 53 |
|
54 |
+ agent.options['recipients'] = '{% if x %}a@x{% else %}b@y{% endif %}' |
|
55 |
+ expect(agent).to be_valid |
|
56 |
+ |
|
54 | 57 |
agent.options['recipients'] = ['bob@example.com', 'jane@example.com'] |
55 | 58 |
expect(agent).to be_valid |
56 | 59 |
|
@@ -88,4 +91,4 @@ shared_examples_for EmailConcern do |
||
88 | 91 |
expect(agent.recipients('username' => 'bob', 'domain' => 'example.com')).to eq(["bob@example.com"]) |
89 | 92 |
end |
90 | 93 |
end |
91 |
-end |
|
94 |
+end |